package com.tuniu.agents.tools.trip;

import com.tuniu.agents.tools.trip.tool.ItineraryPlanListTool;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Description;

@Configuration
@EnableConfigurationProperties(TripProperties.class)
@ConditionalOnClass(TripProperties.class)
@ConditionalOnProperty(prefix = "aigc.agents.tools.trip", name = "enabled", havingValue = "true")
public class TripAutoConfiguration {


    @Bean(ItineraryPlanListTool.TOOLNAME)
    @ConditionalOnMissingBean
    @Description("query itinerary resources")
    @Tool(returnDirect = true)
    public ItineraryPlanListTool itineraryPlanListTool(TripProperties properties) {
        return new ItineraryPlanListTool(properties);
    }
}
